package Stack;

import java.util.Stack;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 周斌
 * Date: 2024-03-10
 * Time: 20:25
 */
public class ArrayTest {
     public static void main(String[] args) {
         Stack<Integer> stack = new Stack<>();
         //push 压栈/入栈
         stack.push(1);
         stack.push(2);
         stack.push(3);
         stack.push(4);
         //pop 出栈(相当于删除) 满足先进后出，后进先出。
         /*int ret = stack.pop();
         System.out.println(ret);*/
         //peek 与出栈一样，但不会删除，只是查看栈顶的数据
         int ret2 = stack.peek();
         System.out.println(ret2);
    }
}
